package com.itheima.demo1;

import java.util.HashMap;
import java.util.Set;

public class Stringtest {
    public static void main(String[] args) {
        String s="If you want f to change your fate g I think you g must come g to the dark horse h to learn h java";
        String s1=s.toLowerCase();
        int index = 0 ;
        int count = 0;
        String[] strings=s1.split(" ");
        HashMap<Integer,String> hm = new HashMap<>();
        for (int i = 0; i < strings.length; i++) {
            if (hm.containsValue(strings[i])){
                continue;
            }
            hm.put(index++, strings[i]);
            for (String string : strings) {
                if (strings[i].equals(string)){
                    count++;
                }
            }
            System.out.println(strings[i]+"="+count);
           count = 0;
        }

    }
}
